<template>
  <ul class="detail-bottom">
    <li class="bottom-top" @click="selectAllMusic">
      <div class="bottom-icon"></div>
      <div class="bottom-title">播放全部</div>
    </li>
    <!-- 可播放歌曲列表 -->
    <li v-for="value in playlist" :key="value.id" class="item" @click="selectMusic(value.id)">
      <h3>{{value.name}}</h3>
      <p>{{value.al.name}} - {{value.ar[0].name}}</p>
    </li>
  </ul>
</template>

<script>
import {mapActions} from 'vuex'
export default {
  name:"DetaliBottm",
  props:{
    playlist:{
      type:Array,
      default:()=>[],
      required:true
    }
  },
  methods:{
    ...mapActions([
      'setFullScreen',
      'setSongDetail'
    ]),
    //点击某一首音乐
    selectMusic(id){
      // this.$store.dispatch('setFullScreen',true)
      //显示播放界面
      this.setFullScreen(true);
      //设置歌曲播放明细
      this.setSongDetail([id])
    },
    //点击所有播放全部
    selectAllMusic () {
      this.setFullScreen(true)
      //获取所有可播放歌曲id以获取所有歌曲详情
      let ids = this.playlist.map(function (item) {
        return item.id
      })
      this.setSongDetail(ids)
    }
  }
}
</script>

<style lang="scss" scoped>
@import"../../assets/css/mixin";
@import"../../assets/css/variable";
.detail-bottom{
  width: 100%;
  li{
    width: 100%;
    height: 100px;
    padding: 12px 20px 0px 20px;
    box-sizing: border-box;
    @include bg_sub_color();
    border-bottom: 1px solid #ccc;
  }
  .bottom-top{
    display: flex;
    align-items: center;
    border-top-left-radius: 50px;
    border-top-right-radius: 50px;
    .bottom-icon{
      width: 60px;
      height: 60px;
      @include bg_img('../../assets/images/small_play');
      margin-right: 20px
    }
    .bottom-title{
      @include font_size($font_large);
      @include font_color() 
    }
  }
  .item{
    @include font_color();
    h3{
      @include font_size($font_medium)
    }
    p{
      @include clamp(1);
      @include font_size($font_samll);
      opacity: 0.8;
      margin-top: 10px;
    }
  }
}
</style>